#ifndef __UNITSTATS_HPP__
#define __UNITSTATS_HPP__ 1

#include <cstdint>
#include <unordered_map>

enum class StatId : int32_t
{
	STAT_UNSET =		0,
	STAT_FIRST,
	STAT_HEALTH = STAT_FIRST,
	STAT_HEALTHPERLEVEL,
	STAT_HEALTHPERVITA,
	STAT_MAXHEALTH,
	STAT_MANA,
	STAT_MANAPERLEVEL,
	STAT_MANAPERENER,
	STAT_MAXMANA,
	STAT_STAMINA,
	STAT_STAMINAPERLEVEL,
	STAT_STAMINAPERSTR,
	STAT_MAXSTAMINA,
	STAT_STR,
	STAT_DEX,
	STAT_VITA,
	STAT_ENER,
	STAT_DEFENSE,
	STAT_BLOCK,
	STAT_BLOCKPERDEX,
	STAT_MAXBLOCK,
	STAT_LAST = STAT_MAXBLOCK
};

struct Stat
{
	int32_t ownerId;
	StatId statId;
	int32_t statVal;
	Stat() : ownerId(-1), statId(StatId::STAT_UNSET), statVal(0) { ;; }
};

struct BaseStats
{
	int32_t health;
	int32_t mana;
	int32_t stamina;
	int32_t str;
	int32_t dex;
	int32_t vita;
	int32_t ener;
	int32_t staminaPerLevel;
	int32_t healthPerLevel;
	int32_t manaPerLevel;
	int32_t staminaPerVita;
	int32_t healthPerVita;
	int32_t manaPerEner;
};

// TODO load from data file.
const BaseStats initialStats[] =
{
	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },		// No Class
	{ 0, 0, 0, 5, 10, 10, 15, 1, 2, 2 },	// Wizard
	{ 0, 0, 0, 10, 10, 10, 10, 1, 1, 3 },	// Heretic
	{ 0, 0, 0, 5, 15, 5, 15, 1, 2, 2 },		// Necromancer
	{ 0, 0, 0, 10, 15, 10, 5, 2, 3, 2 },	// Ranger
	{ 0, 0, 0, 15, 5, 15, 5, 3, 2, 2 },		// Giant
	{ 0, 0, 0, 15, 5, 15, 5, 1, 2, 3 },		// Warrior
};

typedef std::unordered_map<std::underlying_type<StatId>::type, Stat*> StatList;

#endif